#ifndef IA32BLOCKCONTEXT_H
#define IA32BLOCKCONTEXT_H

#include "crossbit/BlockContext.h" 
#include "crossbit/IA32Interpreter.h"

namespace crossbit
{
    class IA32BlockContext : public BlockContext
    {
	public:
	    IA32BlockContext(): pState_(NULL)
	    {
		//empty
	    }

	    ~IA32BlockContext()
	    {
		if( pState_ != NULL )
		    delete pState_;
	    }

	    virtual void setProcessorState( ProcessorState* state )
	    {
		if( pState_ == NULL )
		{
		    pState_ = new IA32Interpreter::IA32State();
		}

		(*pState_) = *(dynamic_cast<IA32Interpreter::IA32State*>(state));

	    }

	    virtual ProcessorState* getProcessorState()
	    {
		return dynamic_cast<ProcessorState*>(pState_);	
	    }

	private:
	    IA32Interpreter::IA32State* pState_;
    };
}

#endif //IA32BLOCKCONTEXT_H
